package com.oa.modules.approvalsec1.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.oa.common.utils.AppUtils;
import com.oa.common.utils.Constant;
import com.oa.common.utils.PageUtils;
import com.oa.common.utils.Query;
import com.oa.modules.approvalsec1.dao.BankAccountDao;
import com.oa.modules.approvalsec1.entity.BankAccountEntity;
import com.oa.modules.approvalsec1.service.BankAccountService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service("bankAccountService")
public class BankAccountServiceImpl extends ServiceImpl<BankAccountDao, BankAccountEntity> implements BankAccountService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        params.put("status", Constant.YES_OR_NO.YES.getValue());
        IPage page= AppUtils.getPage(new Query<BankAccountEntity>(), params);
        return AppUtils.setPage(page, baseMapper.findPage(params), baseMapper.findRecords(page, params));
    }

    @Override
    public BankAccountEntity getByCompanyName(String companyName) {
        return baseMapper.getByCompanyName("0",companyName);
    }

    @Override
    public List<BankAccountEntity> queryList(Map<String, Object> params) {
        return baseMapper.queryList(params);
    }

    @Override
    public BankAccountEntity newBankInfo(Map<String, Object> params) {
        return baseMapper.newBankInfo(params);
    }

    @Override
    public PageUtils socialListPage(Map<String, Object> params) {
        params.put("status", Constant.YES_OR_NO.YES.getValue());
        IPage page= AppUtils.getPage(new Query<BankAccountEntity>(), params);
        return AppUtils.setPage(page, baseMapper.socialListCount(params), baseMapper.socialList(page, params));
    }
}
